<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="icon" type="image/x-icon" th:href="@{/img/favicon.ico}">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>考试</title>

    <script th:src="@{/js/jquery-3.3.1.js}"></script>
    <script th:src="@{/js/popper.js}"></script>
    <script th:src="@{/js/toolkit.js}"></script>
    <script th:src="@{/js/component.js}"></script>

    <link th:href="@{/css/antd.css}" rel="stylesheet">
    <link th:href="@{/css/docs.css}" rel="stylesheet">
    <link th:href="@{/css/toolkit-light.css}" rel="stylesheet">

    <style>
        .margin_top {
            margin-top: 12px;
        }

        .logo {
            width: 8%;
            height: auto;
        }

        .nav_top {
            margin-top: 5px;
            right: 1.5%;
        }

        a:link, a:visited, a:hover, a:active {
            text-decoration:none;
        }
    </style>
</head>
<body>
<div class="m-l-md m-r-md">
    <!--导航栏-->
    <div class="text-md-left margin_top">
        <div class="row">
            <img class="logo col-md-1" th:src="@{/img/ahza-black-oj.png}">
            <ul class="nav nav-bordered col-md-10 nav_top">
                <li class="nav-header form-inline">
                    <h1>后台</h1>
                </li>
                <li class="margin_top">
                    <a href="/main">首页</a>
                </li>
                <li class="margin_top"><a href="/paper">试卷</a></li>
                <li class="active margin_top"><a href="/quiz">考试</a></li>
                <li class="margin_top"><a href="/result">成绩</a></li>
                <li class="margin_top"><a href="/logout">退出系统</a></li>
            </ul>
        </div>
    </div>
    <!--分割线-->
    <div class="row">
        <div class="ant-divider ant-divider-horizontal col-md-12">
            <h3 class="hr-divider-content hr-divider-heading"></h3>
        </div>
    </div>

    <h3>已有考试</h3>
    <div th:if="${#lists.isEmpty(quizzes)}">
        <div class="docs-example statcard p-a-md m-b">
            <h3 class="statcard-number">还没有考试</h3>
        </div>
    </div>

    <div th:if="${not #lists.isEmpty(quizzes)}">
        <div th:each="quiz:${quizzes}">
            <a th:href="@{'/quizDetails/'+ ${quiz.id}}">
                <div th:if="${quiz.type == '面向对象程序设计A'}">
                    <div class="statcard statcard-danger p-a-md m-b">
                        <h3 class="statcard-number">
                            <span th:text="${quiz.title}"></span>
                        </h3>
                        <span class="statcard-desc">面向对象程序设计A</span>
                    </div>
                </div>
            </a>
            <a th:href="@{'/quizDetails/'+ ${quiz.id}}">
                <div th:if="${quiz.type == '操作系统'}">
                    <div class="statcard statcard-primary p-a-md m-b">
                        <h3 class="statcard-number">
                            <span th:text="${quiz.title}"></span>
                        </h3>
                        <span class="statcard-desc">操作系统</span>
                    </div>
                </div>
            </a>
            <a th:href="@{'/quizDetails/'+ ${quiz.id}}">
                <div th:if="${quiz.type == '软件工程导论'}">
                    <div class="statcard statcard-success p-a-md m-b">
                        <h3 class="statcard-number">
                            <span th:text="${quiz.title}"></span>
                        </h3>
                        <span class="statcard-desc">软件工程导论</span>
                    </div>
                </div>
            </a>
            <a th:href="@{'/quizDetails/'+ ${quiz.id}}">
                <div th:if="${quiz.type == '数据结构'}">
                    <div class="statcard statcard-info p-a-md m-b">
                        <h3 class="statcard-number">
                            <span th:text="${quiz.title}"></span>
                        </h3>
                        <span class="statcard-desc">数据结构</span>
                    </div>
                </div>
            </a>
            <a th:href="@{'/quizDetails/'+${quiz.id}}">
                <div th:if="${quiz.type == '数据库'}">
                    <div class="statcard statcard-warning p-a-md m-b">
                        <h3 class="statcard-number">
                            <span th:text="${quiz.title}"></span>
                        </h3>
                        <span class="statcard-desc">数据库</span>
                    </div>
                </div>
            </a>
        </div>
    </div>
    <button onclick="window.location.href='/newQuiz'" class="btn btn-primary col-md-3">组织考试</button>
</div>
</body>
</html>